<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Common extends CI_Controller {
    static function current_user(){

    }
    function req($key){
        return isset($_REQUEST[$key])?$_REQUEST[$key]:'';
    }
    function resp_json($data){
        $this->output->set_header('Content-Type: application/json; charset=utf-8');
        $this->output->set_header('Access-Control-Allow-Origin: *');
        echo json_encode($data);
    }
    function resp_api($data=[],$code=1000,$msg='success'){
        $this->resp_json([
            "code"=>$code,
            "msg"=>$msg,
            "data"=>$data,
        ]);
    }
    function resp_html($view,$data){
        $this->load->library('parser');
        $html = $this->parser->parse($view,$data);
        echo $html;
    }
    function pwd($passwd){
        return md5(md5($passwd));
    }
}
